/*     */ package com.jcrj.action.personalOffice;
/*     */ 
/*     */ import com.jcrj.action.BaseAction;
/*     */ import com.jcrj.entity.OFavorite;
/*     */ import com.jcrj.entity.OUser;
/*     */ import com.jcrj.service.FavoriteService;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class FavoriteAction extends BaseAction
/*     */ {
/*     */   private FavoriteService favoriteService;
/*     */   private String name;
/*     */   private List<OFavorite> favoriteList;
/*     */   private OFavorite favorite;
/*     */   private long pageCount;
/*     */   private long totalCount;
/*     */   private String[] ids;
/*     */ 
/*     */   public String initFavorite()
/*     */   {
/*  24 */     return "success";
/*     */   }
/*     */   public String saveFavorite() {
/*     */     try {
/*  28 */       OUser user = (OUser)super.getSession().get("userInfo");
/*  29 */       this.favorite.setUserId(user.getId());
/*  30 */       this.favorite.setCreateTime(new Date());
/*  31 */       this.favoriteService.saveFavorite(this.favorite);
/*  32 */       super.getResponse().getWriter().write("success");
/*  33 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  35 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  38 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/*  40 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  38 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/*  40 */         e.printStackTrace();
/*     */       }
/*     */     }
/*  43 */     return null;
/*     */   }
/*     */ 
/*     */   public String favoriteManage() {
/*  47 */     OUser user = (OUser)super.getSession().get("userInfo");
/*  48 */     this.totalCount = this.favoriteService.countFavoriteTotal(this.name, user.getId().intValue()).longValue();
/*  49 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/*  50 */     if (super.getCurrentPage() > this.pageCount) {
/*  51 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/*  53 */     this.favoriteList = this.favoriteService.getFavoriteList(this.name, super.getCurrentPage(), user.getId().intValue());
/*  54 */     return "success";
/*     */   }
/*     */ 
/*     */   public String deleteFavorite() {
/*     */     try {
/*  59 */       this.favoriteService.deleteFavorite(this.ids);
/*  60 */       super.getResponse().getWriter().write("success");
/*  61 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  63 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  66 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/*  68 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  66 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/*  68 */         e.printStackTrace();
/*     */       }
/*     */     }
/*  71 */     return null;
/*     */   }
/*     */ 
/*     */   public FavoriteService getFavoriteService() {
/*  75 */     return this.favoriteService;
/*     */   }
/*     */   public void setFavoriteService(FavoriteService favoriteService) {
/*  78 */     this.favoriteService = favoriteService;
/*     */   }
/*     */   public String getName() {
/*  81 */     return this.name;
/*     */   }
/*     */   public void setName(String name) {
/*  84 */     this.name = name;
/*     */   }
/*     */   public List<OFavorite> getFavoriteList() {
/*  87 */     return this.favoriteList;
/*     */   }
/*     */   public void setFavoriteList(List<OFavorite> favoriteList) {
/*  90 */     this.favoriteList = favoriteList;
/*     */   }
/*     */   public OFavorite getFavorite() {
/*  93 */     return this.favorite;
/*     */   }
/*     */   public void setFavorite(OFavorite favorite) {
/*  96 */     this.favorite = favorite;
/*     */   }
/*     */ 
/*     */   public long getPageCount() {
/* 100 */     return this.pageCount;
/*     */   }
/*     */ 
/*     */   public void setPageCount(long pageCount) {
/* 104 */     this.pageCount = pageCount;
/*     */   }
/*     */ 
/*     */   public long getTotalCount() {
/* 108 */     return this.totalCount;
/*     */   }
/*     */ 
/*     */   public void setTotalCount(long totalCount) {
/* 112 */     this.totalCount = totalCount;
/*     */   }
/*     */ 
/*     */   public String[] getIds() {
/* 116 */     return this.ids;
/*     */   }
/*     */ 
/*     */   public void setIds(String[] ids) {
/* 120 */     this.ids = ids;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.action.personalOffice.FavoriteAction
 * JD-Core Version:    0.6.0
 */